package tv.scolopender.adapter;

import tv.scolopender.fragment.LikeSectionFragment;
import tv.scolopender.fragment.NewsSectionFragment;
import tv.scolopender.fragment.BestSectionFragment;
import tv.scolopender.fragment.RandomSectionFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/**
 * A {@link FragmentPagerAdapter} that returns a fragment corresponding to one
 * of the sections/tabs/pages.
 */
public class SectionsPagerAdapter extends FragmentPagerAdapter {

	public SectionsPagerAdapter(FragmentManager fm) {
		super(fm);
	}

	@Override
	public Fragment getItem(int position) {
		Fragment fragment = null;
		switch (position) {
		case 0:
			fragment = new NewsSectionFragment();
			break;
		case 1:
			fragment = new BestSectionFragment();
			break;
		case 2:
			fragment = new RandomSectionFragment();
			break;
		case 3:
			fragment = new LikeSectionFragment();
			break;
		}
		// getItem is called to instantiate the fragment for the given page.
		// Return a DummySectionFragment (defined as a static inner class
		// below) with the page number as its lone argument.
		// Bundle args = new Bundle();
		// args.putInt(ScoloSectionFragment.ARG_SECTION_NUMBER, position +
		// 1);
		// fragment.setArguments(args);
		return fragment;
	}

	@Override
	public int getCount() {
		return 4;
	}
}
